package org.zfes.snowier.cloud.zbss.cms.router.service.site;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.site.model.CmsSiteUserDefineAttr;
import org.zfes.snowier.cloud.zbss.cms.site.service.ICmsSiteUserDefineAttrService;
@Controller 
@RequestMapping("/cms/site/cmsSiteUserDefineAttr")
public class CmsSiteUserDefineAttrController extends BaseController {

	
	@Autowired
	private ICmsSiteUserDefineAttrService cmsSiteUserDefineAttrService;
	
	@RequiresPermissions(value="cmsSiteUserDefineAttr:loadCmsSiteUserDefineAttrDataSet",desc="站点属性列表")
    @RequestMapping(value="/loadCmsSiteUserDefineAttrDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteUserDefineAttrDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsSiteUserDefineAttrService.loadCmsSiteUserDefineAttrDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsSiteUserDefineAttr:createCmsSiteUserDefineAttr",desc="站点属性添加")
    @RequestMapping(value="/createCmsSiteUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsSiteUserDefineAttr(CmsSiteUserDefineAttr cmsSiteUserDefineAttr){
		cmsSiteUserDefineAttrService.createCmsSiteUserDefineAttr(cmsSiteUserDefineAttr);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteUserDefineAttr:loadCmsSiteUserDefineAttr",desc="站点属性加载")
    @RequestMapping(value="/loadCmsSiteUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteUserDefineAttr(Long id){
		Optional<CmsSiteUserDefineAttr> ops = cmsSiteUserDefineAttrService.loadCmsSiteUserDefineAttrById(id);
		return ajaxQuery("cmsSiteUserDefineAttr",ops);
    }
	
	@RequiresPermissions(value="cmsSiteUserDefineAttr:updateCmsSiteUserDefineAttr",desc="站点属性更新")
    @RequestMapping(value="/updateCmsSiteUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsSiteUserDefineAttr(CmsSiteUserDefineAttr cmsSiteUserDefineAttr){
		cmsSiteUserDefineAttrService.updateCmsSiteUserDefineAttr(cmsSiteUserDefineAttr);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteUserDefineAttr:deletCmsSiteUserDefineAttr",desc="站点属性删除")
    @RequestMapping(value="/deleteCmsSiteUserDefineAttr", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsSiteUserDefineAttr(Long id){
		cmsSiteUserDefineAttrService.deleteCmsSiteUserDefineAttr(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}